<?php
//
// DB error
//

function dberr($connect, $query = "", $line = 0)
{
	$errmsg = mysql_error($connect);
	$errno = mysql_errno($connect);
	echo("DB error: " . $errmsg . " (". $errno . ")<BR>QUERY: " . $query . "<BR>LINE: " . $line);
	mysql_close($connect);
	exit;
}

//
// Database Connection을 위한 세팅
//

$dbhostname = "localhost";
$dbport = 3306;
$dbsocket = "/opt/local/var/run/mysql55/mysqld.sock";
$dbusername = "emrs";
$dbpassword = "emrs";
$database = "emrs";

//
// Connect to DB Permanently!!
//

$connect = mysql_pconnect($dbhostname . ":" . $dbsocket, $dbusername, $dbpassword) or die("Could not connect to DB!!");
mysql_select_db($database, $connect) or dberr ($connect);
